import pymysql

conn = pymysql.connect(
    host='127.0.0.1',
    port=3306,
    user='THole',
    password='20041123',
    db='thole',
    charset='utf8'
)

cursor = conn.cursor()
a = cursor.execute("SELECT index_card.ID FROM index_card")
lastID = 0
device = 1
needNum = lastID + 16
if (device == 1):
    needNum = lastID + 8
    args = (lastID, lastID + needNum)
    b = cursor.execute("SELECT * FROM index_card where ID BETWEEN %s AND %s", args)
    bb = cursor.fetchall()
    print(bb)
    asd = sorted(bb, reverse=True)

print(1)